package com.iss.demo.controller;

import com.iss.demo.entity.*;
import com.iss.demo.model.MyResponseData;
import com.iss.demo.service.CarOtherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("carother/")
public class CarOtherController {
    @Autowired
    private CarOtherService service;

    @RequestMapping("selectAllBrand")
    public MyResponseData selectAllBrand(){
        List<Brand> list=service.selectAllBrand();
        MyResponseData responseData = new MyResponseData();
        responseData.setStatus("success");
        responseData.setErrorCode(0);
        responseData.setObjectList(list);
        return  responseData;
    }

    @RequestMapping("selectAllDrive")
    public MyResponseData selectAllDrive(){
        List<Drive> list=service.selectAllDrive();
        MyResponseData responseData = new MyResponseData();
        responseData.setStatus("success");
        responseData.setErrorCode(0);
        responseData.setObjectList(list);
        return  responseData;
    }
    @RequestMapping("selectAllInflow")
    public MyResponseData selectAllInflow(){
        List<Inflow> list=service.selectAllInflow();
        MyResponseData responseData = new MyResponseData();
        responseData.setStatus("success");
        responseData.setErrorCode(0);
        responseData.setObjectList(list);
        return  responseData;
    }
    @RequestMapping("selectAllType")
    public MyResponseData selectAllType(){
        List<Type> list=service.selectAllType();
        MyResponseData responseData = new MyResponseData();
        responseData.setStatus("success");
        responseData.setErrorCode(0);
        responseData.setObjectList(list);
        return  responseData;
    }

}
